<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <canvas id="canvas" style="border: 1px solid #aaa; display: block; margin: 50px auto;">
        当前浏览器不支持Canvas，请更换浏览器
    </canvas>
    <script>
        window.onload = function () {
            var canvas = document.getElementById("canvas");

            canvas.width = 800;
            canvas.height = 1000;

            var context = canvas.getContext("2d");

            context.fillStyle = '#058';

            context.font = 'bold 40px sans-serif';
            context.fillText('欢迎大家学习《Canvas绘图接口详解》！', 40, 100);

            context.font = 'italic bold 40px sans-serif';
            context.fillText("欢迎大家学习《Canvas绘图接口详解》！", 40, 200);

            context.font = 'oblique bold 40px sans-serif';
            context.fillText('欢迎大家学习《Canvas绘图接口详解》！', 40, 300);

            context.font = 'small-caps bold 40px sans-serif';
            context.fillText('欢迎大家学习《Canvas绘图接口详解》！', 40, 400);

            context.font = 'lighter 40px impact';
            context.fillText('欢迎大家学习《Canvas绘图接口详解》！', 40, 500);

            context.font = 'normal 40px impact';
            context.fillText('欢迎大家学习《Canvas绘图接口详解》！', 40, 600);

            context.font = 'bold 40px impact';
            context.fillText('欢迎大家学习《Canvas绘图接口详解》！', 40, 700);

            context.font = 'bolder 40px impact';
            context.fillText('欢迎大家学习《Canvas绘图接口详解》！', 40, 800);

        }

    </script>
</body>
</html>